from django.shortcuts import render

from templatetags.my_tags import register


def runoob(request):
    context = {}
    context['hello'] = 'hello world !'
    return render(request, 'runoob.html', context)


def runoob1(request):
    views_name = 'the once try'
    return render(request, 'runoob.html', {'views_name': views_name})


def runoob2(request):
    views_list = ['one', 'two', 'three']
    return render(request, 'runoob.html', {'views_list': views_list})


def runoob3(request):
    views_dict = {'name': 'test dict'}
    return render(request, 'runoob.html', {'views_dict': views_dict})


def runoob4(request):
    name = 0
    return render(request, 'runoob.html', {'name': name})


def runoob5(request):
    name = '学习内容源于菜鸟'
    return render(request, 'runoob.html', {'name': name})


def runoob6(request):
    num = 1024
    return render(request, 'runoob.html', {'num': num})


def runoob7(request):
    import datetime
    now = datetime.datetime.now()
    return render(request, 'runoob.html', {'now': now})


def runoob8(request):
    views_str = '123456789'
    return render(request, 'runoob.html', {'views_str': views_str})


def runoob9(request):
    views_str = "<a href='https://www.runoob.com/'>点击跳转(需要保证路径是绝对安全的)</a>"
    return render(request, 'runoob.html', {'views_str': views_str})

def runoob10(request):
    views_num = 88
    return render(request, 'runoob.html', {'views_num': views_num})


def runoob11(request):
    views_list = ['one', 'two', 'three']
    return render(request, 'runoob.html', {'views_list': views_list})


def runoob12(request):
    view_list = ['one', 'two', 'three']
    return render(request, 'runoob.html', {'view_list': view_list})

def runoob13(request):
    views_dict = {'name': 'test dict', 'age': 18}
    return render(request, 'runoob.html', {'views_dict': views_dict})

def runoob14(request):
    views_list = ['a', 'b', 'c', 'd', 'e']
    return render(request, 'runoob.html', {'list_var': views_list})

def runoob15(request):
    views_list = []
    return render(request, 'runoob.html', {'list_var': views_list})

def runoob16(request):
    views_list = []
    return render(request, 'runoob.html', {'list_var': views_list})


@register.filter
def my_filter(v1, v2):
    return v1 * v2